package com.atguigu.gmall.product.client;

import com.atguigu.gmall.model.product.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@FeignClient(name = "service-product",fallback = DegradedProductFeignClient.class)
public interface ProductFeignClient {

    //带inner表示是内部资源，不允许外部访问
    @GetMapping("/api/product/inner/getSkuInfo/{skuId}")
    public SkuInfo getSkuInfo(@PathVariable Long skuId);

    @GetMapping("/api/product/inner/getBaseCategory/{category3Id}")
    public BaseCategoryView getBaseCategory(@PathVariable Long category3Id);

    @GetMapping("/api/product/inner/getSaleAttrListChecked/{skuId}/{spuId}")
    public List<SpuSaleAttr> getSaleAttrValueChecked(
            @PathVariable("skuId") Long skuId,
            @PathVariable("spuId") Long spuId);

    @GetMapping("/api/product/inner/getValuesSkuJson/{spuId}")
    public Map getValuesSkuJson(@PathVariable Long spuId);

    @GetMapping("/api/product/inner/getPrice/{skuId}")
    public BigDecimal getPrice(@PathVariable Long skuId);

    @GetMapping("/api/product/inner/getBaseCategoryList")
    public List<BaseCategoryView> getBaseCategoryList();

    //根据id查询品牌表
    @GetMapping("/api/product/inner/getBaseTrademark/{id}")
    public BaseTrademark getBaseTrademark(@PathVariable Long id);

    //查询商品平台属性表
    @GetMapping("/api/product/inner/getSkuAttrValue/{skuId}")
    public List<SkuAttrValue> getSkuAttrValue(@PathVariable Long skuId);


}
